package com.atlin.consumer;

import com.atlin.model.UserInfo;
import com.atlin.nrpc.core.RpcApplication;
import com.atlin.nrpc.core.proxy.ServiceProxyFactory;
import com.atlin.service.UserInfoService;

public class ConsumerExample {

    public static void main(String[] args) {
        RpcApplication.init();
//        RpcConfig rpc = ConfigUtils.loadConfig(RpcConfig.class, null);
//        System.out.println(rpc);


        // 获取代理
        UserInfoService userInfoService = ServiceProxyFactory.getProxy(UserInfoService.class);
        UserInfo userInfo = new UserInfo();
        userInfo.setName("张三");
        userInfo.setAge(22);

        // 调用
        UserInfo res = userInfoService.queryUserInfo(userInfo);
        res = userInfoService.queryUserInfo(userInfo);
        res = userInfoService.queryUserInfo(userInfo);
        if (res == null) {
            System.out.println("结果为空");
        } else {
            System.out.println(res);
        }
        short number = userInfoService.getNumber();
        System.out.println(number);
    }
}
